home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6933 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  947 b 

  1. Path: maverick.tad.eds.com!news-admin@tad.eds.com
  2. From: Ed McGuffey <fgae23@ods04.and.ifg.gmeds.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: simple code, argc, argv, strcmp()
  5. Date: 16 Feb 1996 13:08:49 GMT
  6. Organization: Indiana Resource Center
  7. Message-ID: <4g1vl1$rm2@maverick.tad.eds.com>
  8. References: <11f7cc$17261a.3b3@daprez>
  9. NNTP-Posting-Host: ods04.and.ifg.gmeds.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.12 (X11; I; HP-UX A.09.05 9000/715)
  14. X-URL: news:11f7cc$17261a.3b3@daprez
  15.  
  16. If you really want to use the !, try:
  17.  
  18.    if (!((strcmp(argv[1], "-d") || (strcmp(argv[1], "-e"))) 
  19.       Usage();
  20.  
  21. since you want the ! to apply to the entire expression consisting of the
  22. two compares.  The code is more readable, however, to avoid negative logic
  23. altogether and just say:
  24.  
  25.    if ((strcmp(argv[1], "-d") || (strcmp(argv[1], "-e")) 
  26.       function();
  27.    else
  28.       Usage();
  29.  
  30.